<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    @keyframes enter {
      0% {
        transform: translateX(-500px) scale(0.1) rotate(360deg);
        opacity: 0;
      }
      50% {
        transform: translateX(-250px) scale(0.5) rotate(180deg);
        opacity: 0.5;
      }
      100% {
        transform: translateX(-0) scale(1) rotate(0);
        opacity: 1;
      }
    }
    @keyframes leave {
      0% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
      }
      50% {
        transform: translateY(250px) scale(0.5) rotate(180deg);
        opacity: 0.5;
      }
      100% {
        transform: translateY(500px) scale(0.1) rotate(360deg);
        opacity: 0;
      }
    }
    .box{
      width: 200px;
      height: 200px;
      background-color: rgb(209, 76, 76);
      margin: 30px auto;
    }
    .ani1-enter-active{
      animation: enter 1s;
    }
    .ani1-leave-active{
      animation: leave 1s;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="isShow = !isShow">{{isShow?'隐藏':'显示'}}</button>
    <transition name="ani1">
      <div class="box" v-if="isShow"></div>
    </transition>
  </div>
  <script src="./vue.js"></script>
  <script>
    
  
    const vm = new Vue({
      el: '#app',
      data: {
        isShow: true
      }
    })
    
  </script>
</body>
</html>